<template>
	<view class="page">
		<view class="info-content">
			<view class="info-line">
				<label>行业分类</label><text>{{formData.industryClassification}}</text>
			</view>
			<view class="info-line">
				<label>注册资本</label><text>{{formData.registeredCapital}}万元</text>
			</view>
			<view class="info-line">
				<label>经营地址面积</label><text>{{formData.actualBusinessPreArea}}平米</text>
			</view>
			<view class="info-line" style="display: flex; flex-direction: column;">
				<label>附件信息</label>
				<JSGJImages :imagesList="formData.attendanceFileList"></JSGJImages>
			</view>
		</view>
		<u-gap height="20" bg-color="#f0f2f6"></u-gap>
		<sign-uplpad :customerId="customerId" :businessId="formData.businessId" title="注册地址" type="registeredAddress"
			v-if="showUpload" @refresh="refresh"></sign-uplpad>
		<files-list :customerId="customerId" :businessId="formData.businessId" title="注册地址附件"
			type="zhucedizhi"></files-list>
		<u-gap height="20" bg-color="#f0f2f6"></u-gap>
		<sign-uplpad :customerId="customerId" :businessId="formData.businessId" title="实际经营地址"
			type="actualBusinessAddress" v-if="showUpload" @refresh="refresh"></sign-uplpad>
		<files-list :customerId="customerId" :businessId="formData.businessId" title="实际经营地址附件"
			type="jingyingdizhi"></files-list>
		<u-gap height="20" bg-color="#f0f2f6"></u-gap>
		<sign-uplpad :customerId="customerId" :businessId="formData.businessId" title="基本账户信息" type="baseAccount"
			v-if="showUpload" @refresh="refresh"></sign-uplpad>
		<u-gap height="20" bg-color="#f0f2f6"></u-gap>
		<sign-uplpad :customerId="customerId" :businessId="formData.businessId" title="股东信息" type="shareholder"
			v-if="showUpload" @refresh="refresh"></sign-uplpad>
		<u-gap height="20" bg-color="#f0f2f6"></u-gap>
		<sign-uplpad :customerId="customerId" :businessId="formData.businessId" title="股东之间关系说明"
			type="shareholderRelation" v-if="showUpload" @refresh="refresh"></sign-uplpad>
		<files-list :customerId="customerId" :businessId="formData.businessId" title="股东之间关系说明附件"
			type="gongsizhangcheng"></files-list>
		<u-gap height="20" bg-color="#f0f2f6"></u-gap>
		<sign-uplpad :customerId="customerId" :businessId="formData.businessId" title="企业荣誉称号" type="honor"
			v-if="showUpload" @refresh="refresh"></sign-uplpad>
		<u-gap height="20" bg-color="#f0f2f6"></u-gap>
		<sign-uplpad :customerId="customerId" :businessId="formData.businessId" title="主要经营产品" type="equipment"
			v-if="showUpload" @refresh="refresh"></sign-uplpad>
		<u-gap height="20" bg-color="#f0f2f6"></u-gap>
		<sign-uplpad :customerId="customerId" :businessId="formData.businessId" title="主要生产流程" type="productFlow"
			v-if="showUpload" @refresh="refresh"></sign-uplpad>
		<files-list :customerId="customerId" :businessId="formData.businessId" title="主要生产流程附件"
			type="shengchanliucheng"></files-list>
		<u-gap height="20" bg-color="#f0f2f6"></u-gap>
		<sign-uplpad :customerId="customerId" :businessId="formData.businessId" title="参保员工人数"
			type="insuredEmployeeCount" v-if="showUpload" @refresh="refresh"></sign-uplpad>
		<files-list :customerId="customerId" :businessId="formData.businessId" title="参保员工附件"
			type="canbaorenyuan"></files-list>
		<u-gap height="20" bg-color="#f0f2f6"></u-gap>
		<sign-uplpad :customerId="customerId" :businessId="formData.businessId" title="非参保员工人数"
			type="nonInsuredEmployeeCount" v-if="showUpload" @refresh="refresh"></sign-uplpad>
		<files-list :customerId="customerId" :businessId="formData.businessId" title="非参保员工附件"
			type="feicanbaorenyuan"></files-list>
		<u-gap height="20" bg-color="#f0f2f6"></u-gap>
		<sign-uplpad :customerId="customerId" :businessId="formData.businessId" title="兼职员工人数"
			type="partTimeEmployeeCount" v-if="showUpload" @refresh="refresh"></sign-uplpad>
		<files-list :customerId="customerId" :businessId="formData.businessId" title="兼职员工附件"
			type="jianzhirenyuan"></files-list>
		<files-list :customerId="customerId" :businessId="formData.businessId" title="企业客户数字服务合同和发票"
			type="qykhszfwhthfp"></files-list>

		<view class="save-bottom" v-if="showBtn">
			<view class="fixed-btn save-padding">
				<u-button type="primary" class="btn-box" shape="circle"
					@click="$helper.onJump(`/pagesJiushi/customer/baseInfo/baseInfo?id=${customerId}`)">编辑基本信息</u-button>
				<u-button type="success" class="btn-box" shape="circle" @click="show=true">发布需求</u-button>
			</view>
		</view>
		<u-action-sheet :list="list" v-model="show" :cancel-btn="true" @click="handleActionClick"></u-action-sheet>
	</view>
</template>

<script>
	import config from '@/common/js/config.js';
	import signUplpad from '@/pagesJiushi/customer/actualController/components/signUplpad.vue'
	import filesList from '@/pagesJiushi/customer/actualController/components/filesList.vue'
	export default {
		components: {
			signUplpad,
			filesList
		},
		name: 'customerBase',
		props: {
			customerId: {
				type: [Number, String],
				default () {
					return ''
				}
			}
		},
		created() {
			this.showBtn = uni.getStorageSync(config.Global.cache + '_ShowCompanyButton')
		},
		data() {
			return {
				showBtn: false,
				formData: {
					id: '',
					customerName: undefined,
					mobilePhone: undefined,
					socialCreditCode: undefined,
					establishmentDate: null,
					legalRepresentative: undefined,
					registeredCapital: 0.00,
					registeredAddress: undefined,
					customerProfile: undefined,
					industryClassification: undefined,
					actualBusinessAddress: undefined,
					actualBusinessPreArea: undefined,
					actualControllerId: undefined,
					mainProducts: undefined,
					insuredEmployeeCount: 0,
					nonInsuredEmployeeCount: 0,
					partTimeEmployeeCount: 0,
					currentState: 0
				},
				list: [{
						text: '信息服务业务',
						fontSize: 28
					}, {
						text: '信贷需求',
						fontSize: 28
					}
					// , {
					// 	text: '再生资源回收需求',
					// 	fontSize: 28
					// }, {
					// 	text: '礼品福利需求',
					// 	fontSize: 28
					// },
				],
				show: false,
				showUpload: false,
				companyId: null
			};
		},
		watch: {
			customerId: {
				immediate: true,
				deep: true,
				handler(val) {
					this.getFormData()
				}
			}
		},
		methods: {
			refresh() {
				this.showUpload = false
				this.$nextTick(() => {
					this.showUpload = true;
				});
			},
			getFormData() {
				this.$helper.ajax({
					url: "/api/Jiushi/Customerbase/" + this.customerId,
					method: "GET",
					contentType: "application/json",
					success: res => {
						if (res.data.data != null) {
							this.formData = res.data.data
							if (this.formData.customerProfile != "" && this.formData.customerProfile != null) {
								this.formData.attendanceFileList = this.formData.customerProfile.split(',')
							}
							this.showUpload = true
						}

					}
				});
			},
			handleActionClick(index) {
				if (index == 0) {
					this.$helper.onJump(`/pagesJiushi/consultant/consultant?id=${this.customerId}`)

				}
				if (index == 1) {
					this.$helper.onJump(`/pagesJiushi/demand/form/form?id=${this.customerId}`)
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
	.fixed-btn {
		display: flex;
		flex-direction: row;
		justify-content: space-between;
		gap: 20rpx;

		.btn-box {
			flex: 1;
		}
	}
</style>